#ifdef _WIN32
#include "timer.h"
#include <windows.h>

using namespace krryn::core;

void timer::begin(){
	LARGE_INTEGER l_Counter;
	LARGE_INTEGER l_Frequency;

	QueryPerformanceCounter(&l_Counter);
	QueryPerformanceFrequency(&l_Frequency);

	m_StartTime = static_cast<float>(l_Counter.QuadPart) 
		/ static_cast<float>(l_Frequency.QuadPart);
}

void timer::end(){
	m_StartTime = 0;
}

float timer::duration_in_seconds(){
	LARGE_INTEGER l_Counter;
	LARGE_INTEGER l_Frequency;

	QueryPerformanceCounter(&l_Counter);
	QueryPerformanceFrequency(&l_Frequency);

	float l_EndTime = static_cast<float>(l_Counter.QuadPart) 
		/ static_cast<float>(l_Frequency.QuadPart);

	return l_EndTime - m_StartTime;
}

#endif